from orm.service.OtherService import OtherService
from orm.persistence.OtherUtil import *


class OtherServiceImpl(OtherService):

    def addNewLocation(self, dormitoryId, userId, date):
        return addNewLocation( dormitoryId, userId, date)

    def addNewTemperature(self, dormitoryId, temperature, date):
        return addNewTemperature(dormitoryId, temperature, date)

    def addNewHumidity(self, dormitoryId, humidity, date):
        return addNewHumidity(dormitoryId, humidity, date)

    def getAllLocationByUserId(self, userId):
        return getAllLocationByUserId(userId)

    def getAllUserIdNotInDormitory(self, date):
        return getAllUserIdNotInDormitory(date)

    def getAllDormitoryIdNotFinish(self, date):
        userList = getAllUserIdNotInDormitory(date)
        dormitoryList = []
        for i in userList:
            if i.dormitoryId not in dormitoryList:
                dormitoryList.append(i.dormitoryId)
        return dormitoryList

    def getAllTemperatureByDormitoryId(self, userId):
        return getAllTemperatureByDormitoryId(userId)

    def getAllHumidityByDormitoryId(self, dormitoryId):
        return getAllHumidityByDormitoryId(dormitoryId)

    def getAllTemperatureOfTodayByDormitoryId(self, dormitoryId):
        return getAllTemperatureOfTodayByDormitoryId(dormitoryId)

    def getAllHumidityOfTodayByDormitoryId(self, dormitoryId):
        return getAllHumidityOfTodayByDormitoryId(dormitoryId)

    def getATemperatureOf_n_Days(self, dormitoryId, n):
        return getATemperatureOf_n_Days(dormitoryId, n)

    def getAHumidityOdf_n_Days(self, dormitoryId, n):
        return getAHumidityOf_n_Days(dormitoryId, n)
